package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;

/**
 * 企业信息表
 */
@Entity
@Table(name = "ccd_edinfo")
@JsonApiResource(type = "edinfo")
@Inheritance(strategy = InheritanceType.JOINED)
public class Edinfo extends BaseEntity implements java.io.Serializable {
	private String code;// 编码
	private String legalname;// 法人名
	private Dicttype idType;// 证件类型
	private String idcardNum;// 证件号
	private String legalTel;// 办公室电话
	private String legalPhone;// 法人手机号码
	private String legalEmail;// 法人邮箱
	private String idPhoto;// 证件照
	private String idPhotoReverse;//证件照反面
/*	private String idcardNumForHeader;// 负责人证件号
	private String idPhotoForHeader;// 负责人证件照
	private Dicttype idTypeForHeader;// 负责人证件类型
	private String idPhotoReverseForHeader;//负责人证件照反面*/
	private String businessLicense;// 营业执照
	private String companyPhotos;// 企业照片
	private Dicttype entIdType;//企业证件类型
	private String entIdNumber;//企业证件号码
	private String entIdAddress;//企业证件地址

	@Column(name = "code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "legalname")
	public String getLegalname() {
		return legalname;
	}

	public void setLegalname(String legalname) {
		this.legalname = legalname;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "id_type",foreignKey = @ForeignKey(name = "null"))
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	public Dicttype getIdType() {
		return idType;
	}

	public void setIdType(Dicttype idType) {
		this.idType = idType;
	}

	@Column(name = "idcard_num")
	public String getIdcardNum() {
		return idcardNum;
	}

	public void setIdcardNum(String idcardNum) {
		this.idcardNum = idcardNum;
	}

	@Column(name = "legal_tel")
	public String getLegalTel() {
		return legalTel;
	}

	public void setLegalTel(String legalTel) {
		this.legalTel = legalTel;
	}

	@Column(name = "legal_phone")
	public String getLegalPhone() {
		return legalPhone;
	}

	public void setLegalPhone(String legalPhone) {
		this.legalPhone = legalPhone;
	}

	@Column(name = "legal_email")
	public String getLegalEmail() {
		return legalEmail;
	}

	public void setLegalEmail(String legalEmail) {
		this.legalEmail = legalEmail;
	}

	@Column(name = "id_photo")
	public String getIdPhoto() {
		return idPhoto;
	}

	public void setIdPhoto(String idPhoto) {
		this.idPhoto = idPhoto;
	}

	@Column(name = "id_photo_reverse")
	public String getIdPhotoReverse() {
		return idPhotoReverse;
	}

	public void setIdPhotoReverse(String idPhotoReverse) {
		this.idPhotoReverse = idPhotoReverse;
	}

	/*@Column(name = "idcard_num_header")
	public String getIdcardNumForHeader() {
		return idcardNumForHeader;
	}

	public void setIdcardNumForHeader(String idcardNumForHeader) {
		this.idcardNumForHeader = idcardNumForHeader;
	}

	@Column(name = "id_photo_header")
	public String getIdPhotoForHeader() {
		return idPhotoForHeader;
	}

	public void setIdPhotoForHeader(String idPhotoForHeader) {
		this.idPhotoForHeader = idPhotoForHeader;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "id_type_header",foreignKey = @ForeignKey(name = "null"))
	public Dicttype getIdTypeForHeader() {
		return idTypeForHeader;
	}

	public void setIdTypeForHeader(Dicttype idTypeForHeader) {
		this.idTypeForHeader = idTypeForHeader;
	}

	@Column(name = "id_photo_reverse_header")
	public String getIdPhotoReverseForHeader() {
		return idPhotoReverseForHeader;
	}

	public void setIdPhotoReverseForHeader(String idPhotoReverseForHeader) {
		this.idPhotoReverseForHeader = idPhotoReverseForHeader;
	}*/

	@Column(name = "business_license")
	public String getBusinessLicense() {
		return businessLicense;
	}

	public void setBusinessLicense(String businessLicense) {
		this.businessLicense = businessLicense;
	}

	@Column(name = "company_photos")
	public String getCompanyPhotos() {
		return companyPhotos;
	}

	public void setCompanyPhotos(String companyPhotos) {
		this.companyPhotos = companyPhotos;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "ent_id_type",foreignKey = @ForeignKey(name = "null"))
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	public Dicttype getEntIdType() {
		return entIdType;
	}

	public void setEntIdType(Dicttype entIdType) {
		this.entIdType = entIdType;
	}

	@Column(name = "ent_id_number")
	public String getEntIdNumber() {
		return entIdNumber;
	}

	public void setEntIdNumber(String entIdNumber) {
		this.entIdNumber = entIdNumber;
	}

	@Column(name = "ent_id_address")
	public String getEntIdAddress() {
		return entIdAddress;
	}

	public void setEntIdAddress(String entIdAddress) {
		this.entIdAddress = entIdAddress;
	}
}